Mailhog.addNginxConfiguration   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
1
import * as fs from 'fs'
2
import nginxMailhogConf from '../templates/nginx/mailhog'
3
import {getConfig, jaleNginxAppsPath} from '../utils/jale'
4
import Nginx from './nginx'
5
import Service from './service'
6
7
class Mailhog extends Service {
8
    service = 'mailhog'
9
10
11
    nginxConfigPath = `${jaleNginxAppsPath}/mailhog.conf`
12
13
    configure = async (): Promise<boolean> => {
14
        await this.addNginxConfiguration()
15
        await (new Nginx).restart()
16
17
        return true
18
    }
19
20
    /**
21
     * Install the Mailhog Nginx configuration.
22
     */
23
    addNginxConfiguration = async (): Promise<void> => {
24
        const config = await getConfig()
25
        return fs.writeFileSync(this.nginxConfigPath, nginxMailhogConf(config.tld))
26
    }
27
28
}
29
30
export default Mailhog
31